#pragma once
#include <unistd.h>
#include <fcntl.h>
#include "Log.hpp"

//设置指定的fd为非阻塞
void SetNonBlock(int fd)
{
    int fn = fcntl(fd, F_GETFL);
    if (fn < 0)
    {
        lg(Error, "fcntl error!");
        return;
    }
    fcntl(fd, F_SETFL, fn | O_NONBLOCK);
}
